# Contributor: Sean Summers <seansummers@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=tomcat-native
pkgver=2.0.7
pkgrel=0
pkgdesc="Native resources optional component for Apache Tomcat"
url="https://tomcat.apache.org/native-doc/"
# riscv64: blocked by java-jdk
arch="all !riscv64"
license="Apache-2.0"
makedepends="
	apr-dev
	chrpath
	java-jdk
	libtool
	openssl-dev
	"
subpackages="$pkgname-dev"
source="https://archive.apache.org/dist/tomcat/tomcat-connectors/native/$pkgver/source/tomcat-native-$pkgver-src.tar.gz"
builddir="$srcdir/$pkgname-$pkgver-src/native"
options="!check" # package has no tests

build() {
	./configure \
		--prefix=/usr \
		--with-apr=/usr/bin/apr-1-config \
		--with-java-home=/usr/lib/jvm/default-jvm \
		--with-ssl=/usr/lib
	make
}

package() {
	make DESTDIR="$pkgdir" install

	# Remove redundant rpath.
	chrpath --delete "$pkgdir"/usr/lib/libtcnative-*.so

	rm -f "$pkgdir"/usr/lib/*.la
}

dev() {
	default_dev
	mv "$subpkgdir"/usr/lib/libtcnative-*.so "$pkgdir"/usr/lib/
}

sha512sums="
625b334271494f7c86c06d6a8c6d13c06d9d6094f65cccbdc8d3df13ee2aae4cb42ad326e20bcbf8a8f141240111778991882f9bf87793b09a2920433d6c8c85  tomcat-native-2.0.7-src.tar.gz
"
